<template>
  <el-card>
    <!-- 
      普通数据使用props通信
        title\value
      标签数据使用插槽通信
        body\footer

        最重要的内容优先考虑默认插槽，其他插槽用具名
     -->
    <div class="common-card__title">{{ title }}</div>
    <div class="common-card__value">{{ value }}</div>
    <div class="common-card__body">
      <slot />
    </div>
    <div class="common-card__footer">
      <slot name="footer" />
    </div>
  </el-card>
</template>

<script lang="ts">
export default {
  name: "CommonCard",
};
</script>

<script lang="ts" setup>
defineProps<{
  title: string;
  value: number;
}>();
</script>

<style scoped>
.common-card__title {
  font-size: 12px;
  color: gray;
}
.common-card__value {
  font-size: 25px;
  margin: 5px 0;
}
.common-card__body {
  height: 50px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.common-card__footer {
  border-top: 1px solid #eee;
  margin-top: 10px;
  padding-top: 10px;
  font-size: 12px;
}
</style>
